define tftp($datapath, $disable="no") {

  exec { create_tftp_dir:
    command => "mkdir -p $datapath",
    creates => "$datapath",
  }
            
  package { "tftp-server":
    ensure => installed,
  }
  
  file { "tftp":
    path => "/etc/xinetd.d/tftp",
    owner => root,
    group => root,
    mode => 644,
    content => template("tftp/tftp.erb"),
    ensure => present,
    require => Package["tftp-server"],
    notify => Service["xinetd"]
  }
  
  service { "xinetd":
    ensure => "running",
    hasstatus => "false",
    hasrestart => "false",
    require => [File["tftp"],Package["tftp-server"], Exec["create_tftp_dir"]],
  }
}
